package com.ruoyi.function.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.function.mapper.OrderItemsMapper;
import com.ruoyi.function.domain.OrderItems;
import com.ruoyi.function.service.IOrderItemsService;

/**
 * 购买商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-20
 */
@Service
public class OrderItemsServiceImpl implements IOrderItemsService 
{
    @Autowired
    private OrderItemsMapper orderItemsMapper;

    /**
     * 查询购买商品
     * 
     * @param id 购买商品主键
     * @return 购买商品
     */
    @Override
    public OrderItems selectOrderItemsById(Long id)
    {
        return orderItemsMapper.selectOrderItemsById(id);
    }

    /**
     * 查询购买商品列表
     * 
     * @param orderItems 购买商品
     * @return 购买商品
     */
    @Override
    public List<OrderItems> selectOrderItemsList(OrderItems orderItems)
    {
        return orderItemsMapper.selectOrderItemsList(orderItems);
    }

    /**
     * 新增购买商品
     * 
     * @param orderItems 购买商品
     * @return 结果
     */
    @Override
    public int insertOrderItems(OrderItems orderItems)
    {
        orderItems.setCreateTime(DateUtils.getNowDate());
        return orderItemsMapper.insertOrderItems(orderItems);
    }

    /**
     * 修改购买商品
     * 
     * @param orderItems 购买商品
     * @return 结果
     */
    @Override
    public int updateOrderItems(OrderItems orderItems)
    {
        orderItems.setUpdateTime(DateUtils.getNowDate());
        return orderItemsMapper.updateOrderItems(orderItems);
    }

    /**
     * 批量删除购买商品
     * 
     * @param ids 需要删除的购买商品主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemsByIds(Long[] ids)
    {
        return orderItemsMapper.deleteOrderItemsByIds(ids);
    }

    /**
     * 删除购买商品信息
     * 
     * @param id 购买商品主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemsById(Long id)
    {
        return orderItemsMapper.deleteOrderItemsById(id);
    }
}
